import { Component } from '@angular/core';
import { Router } from '@angular/router';
/**
 * 侧边栏模块相关数据
 * @example
 *import { Router } from '@angular/router';
 *class AppComponent{
   constructor(private router:Router){}
   goRoute(route:any){
    //根据获取的 path 跳转到对应的页面
    this.router.navigate([route.path],{})
  }
 }
 */
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  /**
   * @example
   * RouteList 定义路由数据
   */
  RouteList = [
    {path:"/music/list",name:"音乐管理"},
    {path:"/music/comment",name:'评论管理'}
  ]
  constructor(private router:Router){
  }
  /**
   * @example 
   * <mat-list-option (click)="goRoute(route)" *ngFor="let route of RouteList" [value]="route" class="li">
            {{route.name}}
     </mat-list-option>
   */
  goRoute(route:any){
    this.router.navigate([route.path],{})
  }
}
